<?php
/*****************
* wondershare Support模板接口类
*创建日期:2012-4-24
*作者：tjx
******************/

include(dirname(__FILE__).'/../public/public_support.php');
class WondershareSupport  extends PublicSupport {
	
	function __construct($arr = NULL){
		
	}
	
	/**
	* 得到推荐分类组合
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getRecommendCategory($get = array() ) {
		
		//得到公共函数返回的 sql
		$sql = $this->recommendCategory($get);
		$result = $GLOBALS['db']->query($sql);

		while ($rs = $GLOBALS['db']->fetch_array($result)) {
			
			$str .= '<li>'.$rs['type_name'].'</li>';
		}
		unset($rs);
		return $str;
	}

	/**
	* 推荐Order文章
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getRecommendOrderArticle($get = array() ) {
		
		$get['limit'] = 10;
		//得到公共函数返回的 $webInfoArr
		$arr = $this->recommendOrderArticle($get);
		
		$webInfo = $arr['webInfo'];
		$result = $GLOBALS['db']->query($arr['sql']);
		
		$i = 1;
		while ($rs = $GLOBALS['db']->fetch_array($result)) {
			
			if ($rs['type_id'] == 6) {
				$sql = "SELECT url 
						FROM Table_{$webInfo['faq_info']['table']} 
						WHERE Field_{$webInfo['faq_info']['temKey']} = '{$rs['id']}' ";
				
			} else {
				$sql = "SELECT url 
						FROM Table_'{$webInfo['order_info']['table']}' 
						WHERE Field_'{$webInfo['order_info']['temKey']}' = '{$rs['id']}' ";
				
			}
			
			$url = url_new_replace($GLOBALS['db']->getOne($sql), $webInfo['url_type'], $webInfo['web_domain']);
			
			if (strlen($rs['title']) > 60) {
				$rs['sub_title'] = substr($rs['sub_title'], 0, 60).'...';
			} else {
				$rs['sub_title'] = $rs['sub_title'];
			}
					
			$class = ' class="question" ';
			if ($i % 2 == 0) {
				$class = ' class="question even" ';
			}
			$str .= '<p class='.$class.'>▪ <a href="'.$url.'">'.$rs['sub_title'].'</a></p>	';
		}
		
		unset($rs);
		return $str;
	}
	
	/**
	* 得到分类相关FAQ信息
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getCategoryRelatedFaq($get = array() ) {
		
		$str = '';
		//得到公共函数返回的 $arr
		$arr = $this->categoryRelatedFaq($get);
		$webInfo = $arr['webInfo'];
		$cate_row = $arr['cate_row'];
	
		foreach ($cate_row AS $value) {
			
			if ($value == 6 ) {
				$sql = "SELECT new.title,type.type_name,tem.url 
						FROM faq_operation_types AS o_type 
						LEFT JOIN faq_info_new new ON o_type.id = new.id 
						LEFT JOIN Table_{$webInfo['faq_info']['table']} tem ON tem.Field_{$webInfo['faq_info']['temKey']} = new.id 
						LEFT JOIN faq_type type ON new.type_id = type.type_id	 
						WHERE new.type_id = '{$value}' AND o_type.web_type = '{$webInfo['web_fage']}' AND new.web_type = '{$webInfo['web_fage']}' AND o_type.is_recommend_index = 1 LIMIT 10 ";
			
			} else {
				$sql = "SELECT new.title,type.type_name,tem.url 
						FROM faq_operation_types AS o_type 
						LEFT JOIN faq_info_new new ON o_type.id = new.id 
						LEFT JOIN Table_{$webInfo['order_info']['table']} tem ON tem.Field_{$webInfo['order_info']['temKey']} = new.id 
						LEFT JOIN faq_type type ON new.type_id = type.type_id 
						WHERE new.type_id = '{$value}' AND o_type.web_type = '{$webInfo['web_fage']}' AND new.web_type = '{$webInfo['web_fage']}' AND o_type.is_recommend_index = 1 LIMIT 10 ";
			
			
			}
			
			$result = $GLOBALS['db']->query($sql);
			$i = 0;
			
			while ($rs = $GLOBALS['db']->fetch_array($result)) { 
				
				if (strlen($rs['title']) > 60) {
					$rs['s_title'] = substr($rs['title'], 0, 60).'...';
				} else {
					$rs['s_title'] = $rs['title'];
				}
				
				$url = url_new_replace($rs['url'], $webInfo['url_type'], $webInfo['web_domain']);
				
				if ($i == 0) {
					$str .= '<div class="tab_cont"><dl><dt>'.$rs['type_name'].'</dt>';
				}
				
				if ($i % 2 == 0) {
					$str .= '<dd class="lbg"><a href="'.$url.'" title="'.$rs['title'].'" >'.$rs['s_title'].'</a></dd>';
				} else {
					$str .= '<dd><a href="'.$url.'" title="'.$rs['title'].'" >'.$rs['s_title'].'</a></dd>';
				}
				$i = $i + 1;
			}
			
			if ($value == 6) {
				$url = 'product-support/how-tos/';
			} else {
				$sql = "SELECT Table_{$webInfo['order_category']['table']}.url 
						FROM Table_{$webInfo['order_category']['table']},faq_type 
						WHERE faq_type.type_name = Table_{$webInfo['order_category']['table']}.Field_{$webInfo['order_category']['categoryName']} AND faq_type.type_id = '{$value}'";
		
				$url = url_new_replace($GLOBALS['db']->getOne($sql), $webInfo['url_type'], $webInfo['web_domain']);
			}
			
			if (!empty($i)) {
				$str .= '</dl><p class="more"><a href="'.$url.'">More>></a></p></div>';
			}
		
		}
		
		unset($rs);
		return $str;
	}
	
	/**
	* 得到推荐产品组合
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getRecommendProducts($get = array() ) {
		
		$get['limit'] = 10;
		$arr = $this->recommendProducts($get);
		$webInfo = $arr['webInfo'];
		
		$result = $GLOBALS['db']->query($arr['sql']);
		$i = 0;
		while ($rs = $GLOBALS['db']->fetch_array($result)) {

			$url = url_new_replace($rs['url'], $webInfo['url_type'], $webInfo['web_domain']);
			$str .= '<div class="item"><a href="'.$url.'"><img src="'.$rs['product_box_middle'].'"  height="105" />
					<span>'.$rs['product_name'].'</span></a></div>';
			if (($i + 1) % 5 == 0 ) { 
				$str .= '<div class="clear"></div>';
			} 
			
			$i = $i + 1;
		}
	
		unset($rs);
		return $str;
		
		
	}
	
	/**
	* 得到固定二大分类
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getFixedTwoCategory($get = array() ) {
		
		$str ='';	
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		//查询分类为1
		$select_arr = array(0 => 7, 1 => 4);
		
		foreach ($select_arr AS $value) {
			
			$sql = "SELECT faq.title,faq.description,faq.id,tab.url 
					FROM faq_operation_types AS o_type 
					LEFT JOIN faq_info_new faq ON o_type.id = faq.id 
					LEFT JOIN Table_{$webInfo['order_info']['table']} tab ON tab.Field_{$webInfo['order_info']['temKey']} = faq.id 
					WHERE faq.type_id = '{$value}' AND o_type.web_type = '{$webInfo['web_fage']}' AND faq.web_type = '{$webInfo['web_fage']}' 
					GROUP BY faq.title 
					ORDER BY o_type.is_important DESC LIMIT 3 ";
			$result = $GLOBALS['db']->query($sql);
			
			if($value == 7 ) {
				$sql = "SELECT url 
						FROM Table_{$webInfo['order_category']['table']} 
						WHERE Field_{$webInfo['order_category']['categoryName']} = 'Pre-sale Inquiry' ";
				
				$str .= '<div class="ordbox fl"><h2>Pre-sale Inquiry</h2><div class="bg"><dl>';
			} else if($value == 4) {
				$sql = "SELECT url 
						FROM Table_{$webInfo['order_category']['table']} 
						WHERE Field_{$webInfo['order_category']['categoryName']} = 'Registration' ";
				
				$str .= '<div class="ordbox fr"><h2>Registration</h2><div class="bg"><dl>';
			}
			
			$url_type = $GLOBALS['db']->getOne($sql);
			$url_type = url_new_replace($url_type, $webInfo['url_type'], $webInfo['web_domain']);
		
			
			$i = 0;
			while ($rs = $GLOBALS['db']->fetch_array($result)) {
				
				$url = url_new_replace($rs['url'], $webInfo['url_type'], $webInfo['web_domain']);
				$str .= '<dt><a href="'.$url.'">'.$rs['title'].'</a></dt>';
				if ($i == 0) {
					$str .= '<dd>'.$rs['description'].'<a href="'.$url.'">Learn More>></a></dd>';
				}
				$i = $i + 1;
			}
			
			if ($value == 7 ) {
				$str .= '</dl><p class="more"><a href="'.$url_type.'">More about Pre-sale Inquiry>></a></p></div><div     
				class="btmbg"></div></div>';
			} else if($value == 4) {
				$str .= '</dl><p class="more"><a href="'.$url_type.'">More about Registration>></a></p></div><div     
				class="btmbg"></div></div>';
			}
			//判断如果木有文章则重新设置为空
			if($i == 0 ) {
				$str = '';
			}
		}   
		
		unset($rs);
		return $str;
	}
	
	/**
	* 得到对比表分类 信息
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getComparisonCategory($get = array() ) {
		
		$str_cat = $str_html = '';
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		
		$sql = "SELECT cat_id,cat_title 
				FROM category 
				WHERE cat_type = 2 AND cat_web = '{$webInfo['web_fage']}' AND is_delete =0 AND cat_series =1 
				ORDER BY sort_order ASC ";
		$result = $GLOBALS['db']->query($sql);
		
		while ($row = $GLOBALS['db']->fetch_array($result)) {
			
			$sql =  "SELECT cat.cat_title,p_com.url,p_com.Field_{$webInfo['comparison']['temTitle']},p_com.Field_{$webInfo['comparison']['temDescription']}
					 FROM Table_{$webInfo['products']['table']} AS p_tem,won_product AS won_p,category AS cat,Table_{$webInfo['comparison']['table']} AS p_com 
					 WHERE   p_tem.Field_{$webInfo['products']['comName']} != '0' AND p_tem.Field_{$webInfo['products']['pId']} = won_p.id 
							 AND won_p.cat_id = cat.cat_id AND p_com.Field_{$webInfo['comparison']['temName']} = p_tem.Field_{$webInfo['products']['comName']} 
							 AND FIND_IN_SET('{$row['cat_id']}',cat.parent_path) 
					 GROUP BY p_com.D_ID LIMIT 4 ";
			$result1 = $GLOBALS['db']->query($sql);
			
			$i = 0;
			while ($row1 = $GLOBALS['db']->fetch_array($result1)) {
				
				$url = url_new_replace($row1['url'], $webInfo['url_name']);
				
				if ($i == 0) {
					$str_html .= '<div class="tab_cont">';
				}
				
				if ($i % 2 == 0) {
					$str_html .= '<div class="item bg">';
				} else {
					$str_html .= '<div class="item">';
				} 
				
				$str_html .= '<img src="http://'.$webInfo['web_domain'].'/style/style_img/Comparison.png"  
				width="45" height="44" class="fl" /><dl class="text"><dt><a href="'.      
				$url.'">'.$row1['Field_'.$webInfo['comparison']['temTitle']].'</a></dt><dd>'.$row1['Field_'.$webInfo['comparison']['temDescription']].'</dd></dl></div>';
				$i = $i + 1;
			}
			if ($i != 0) {
				$str_cat .= '<li>'.$row['cat_title'].'</li>';
				$str_html .= '</div>';
			}
		}
		if (!empty($str_cat)) {
			$str_cat = '<div class="menu"><p class="tit">What would you want to buy:</p><ul   
			class="tab">'.$str_cat.'</ul></div>';
		}
		
		if (!empty($str_html)) {
			$str_html = '<div class="frbg">'.$str_html.'</div>';
		}
		unset($row1,$row);
		return $str_cat.$str_html;
	}
	
	/**
	* 得到Order分类列表
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function  getOrderCategoryList($get = array() ) {
		
		$str =  '';
		$arr = $this->orderCategoryList($get);
		$webInfo = $arr['webInfo'];

		$result = $GLOBALS['db']->query($arr['sql']);
		while ($rs = $GLOBALS['db']->fetch_array($result)) {
			
			$url = url_new_replace($rs['url'], $webInfo['url_type'], $webInfo['web_domain']);
			
			$str .= '<li ><a href="'.$url.'">'.$rs['type_name'].'</a></li>';
		}
		
		unset($rs);
		return $str;
		
	}
	
	/**
	* 得到具体分类相关FAQ
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function  getDefiniteCategoryRelatedFaq($get = array() ) {
		
		$str = '';
		$type_name = trim($get["FAQ分类名称"]); //得到faq分类
		$arr = $this->definiteCategoryRelatedFaq($get);
		$webInfo = $arr['webInfo'];
		
		$i = 0;
		$result = $GLOBALS['db']->query($arr['sql']);
		while ($rs = $GLOBALS['db']->fetch_array($result)) {
			
			$url = url_new_replace($rs['url'], $webInfo['url_type'], $webInfo['web_domain']);
			if ($i % 2 == 0) {
				$str .= '<li class="bg"><a href="'.$url.'">'.$rs['title'].'</a></li>' ;
			} else {
				$str .= '<li><a href="'.$url.'">'.$rs['title'].'</a></li>' ;
			}
			$i = $i + 1;
		}
		
		if ($i != 0  ) {
			$str = '<div class="title2"><h1>'.$type_name.'</h1> </div><ul class="n_list1">'.$str.'</ul>';
		}
		
		unset($rs);
		return  $str;
		
	}
	
	/**
	* 得到Order_Support相关分类
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function  getRelatedCategory($get = array() ) {
		
		$str = '';
		$arr = $this->relatedCategory($get);
		$webInfo = $arr['webInfo'];
		
		$result = $GLOBALS['db']->query($arr['sql']);
		$i = 0;
		while ($rs = $GLOBALS['db']->fetch_array($result)) {
			
			$url = url_new_replace($rs['url'], $webInfo['url_type'], $webInfo['web_domain']);
			if ($i % 2 == 0) {
				$str .= '<div class="item bg">' ;
			} else {
				$str .= '<div class="item">' ;
			}
			
			$str .= '<img src="http://'.$webInfo['web_domain'].'/style/style_img/Topics.png" width="45" height="42" class="fl" />
					<dl class="text"><dt><a href="'.$url.'">'.$rs['Field_20794'].'</a></dt>
					<dd>'.$rs['Field_20797'].'</dd></dl></div>';
			$i = $i + 1;
		}
		
		unset($rs);
		return  $str;
		
	}
	
	/**
	* 得到Order_Support具体Order分类列表
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function  getDefiniteOrderCategoryList($get = array() ) {
		
		$str = '';
		$type_name = trim($get["FAQ分类名称"]); //得到faq分类
		$arr = $this->definiteOrderCategoryList($get);
		$webInfo = $arr['webInfo'];
		
		$result = $GLOBALS['db']->query($arr['sql']);
		while ($rs = $GLOBALS['db']->fetch_array($result)) {
			
			$li_select_css =  '';
			if ($type_name == trim($rs['type_name']) ) {
				$li_select_css = 'class="curr"';
			}
			
			$url = url_new_replace($rs['url'], $webInfo['url_type'], $webInfo['web_domain']);
			$str .= '<li '.$li_select_css.'><a  href="'.$url.'">'.$rs['type_name'].'</a></li>';
		}
		
		unset($rs);
		return $str;
		
	}
	
	/**
	* 得到Order-Support-help-me-choose分类模板对比表列表
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function  getComparisonList($get = array() ) {
		
		$str = '';
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		
		$sql = "SELECT tem.url,tem.Field_{$webInfo['comparison']['temTitle']},tem.Field_{$webInfo['comparison']['temDescription']}
				FROM Table_{$webInfo['comparison']['table']} AS tem ";
		$result = $GLOBALS['db']->query($sql);
		
		while ($row = $GLOBALS['db']->fetch_array($result)) {
			
			$url = url_new_replace($row['url'], $webInfo['url_name']);
			
			if ($i % 2==0) {
				$str .= '<div class="item bg">';
			} else {
				$str .= '<div class="item">';
			} 
			
			$str .= '<img src="http://'.$webInfo['web_domain'].'/style/style_img/Comparison.png"  
			width="45" height="44" class="fl" /><dl class="text"><dt><a href="'.      
			$url.'">'.$row['Field_'.$webInfo['comparison']['temTitle']].'</a></dt><dd>'.
			$row['Field_'.$webInfo['comparison']['temDescription']].'</dd></dl></div>';
			$i = $i + 1;
		}
		
		unset($row);
		return $str ;
		
	}
	
	/**
	* 得到Order文章内容
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getArticleContent($get = array() ) {
		
		$contents = $this->articleContent($get);//得到内容
		return support_replace_img($contents, 'i.wondershare.com');
	}
	
	/**
	* 得到Order_Support文章   Order文章分类列表
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function  getArticleOrderCategoryList($get = array() ) {
		
		$str =  '';
		$arr = $this->articleOrderCategoryList($get);
		$webInfo = $arr['webInfo'];
		
		$rows = $GLOBALS['db']->getAll($arr['sql']);

		foreach ($rows AS $key => $value) {
			
			 $li_select_css = '';
			 if ($webInfo['type_id'] == $value['type_id'] ) {
				$li_select_css = 'class="curr"';
			 }
			$url = url_new_replace($value['url'], $webInfo['url_type'], $webInfo['web_domain']);
			$str .= '<li '.$li_select_css.'><a href="'.$url.'">'.$value['type_name'].'</a></li>';
		}
		unset($rows);
		return $str;
		
	}
	
	/**
	* 得到Order_Support文章    文章相关分类链接
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getArticleCategoryHref($get = array() ) {
		
		$str = '';
		$arr = $this->articleCategoryHref($get);
		$webInfo = $arr['webInfo'];
		
		$row = $GLOBALS['db']->getOneRs($arr['sql']);
		if (!empty($row['url'])) {
			$url = url_new_replace($row['url'], $webInfo['url_type'], $webInfo['web_domain']);
			$str = '<a href="'.$url.'">Back to '.$row['type_name'].' >></a>';
		}
		
		unset($row);
		return $str;
	
	}
	
	/**
	* 得到Order_Support文章   对应其他分类Order文章
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getOrderOtherCategoryArticle($get = array() ) {
		$str =  '';
		$arr = $this->orderOtherCategoryArticle($get);
		$webInfo = $arr['webInfo'];
		
		$result = $GLOBALS['db']->query($arr['sql']);
		while ($rs = $GLOBALS['db']->fetch_array($result)) {
			
			$rs['sub_title'] = strlen($rs['title']) > 100 ? substr($rs['title'], 0, 100).'...' : $rs['title'];
			
			$url = url_new_replace($rs['url'], $webInfo['url_type'], $webInfo['web_domain']);
			$str .= '<li><a href="'.$url.'" title="'.$rs['title'].'">'.$rs['sub_title'].'</a></li>';  
		}
		unset($rs);
		return $str;	
		
	}
	
	/**
	* 得到   所有所有一级分类
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getAllOneCategory($get = array() ) {
		
		$str = '';
		$arr = $this->allOneCategory($get);
		$webInfo = $arr['webInfo'];
	
		$result = $GLOBALS['db']->query($arr['sql']);
		while ($rs = $GLOBALS['db']->fetch_array($result)) {
			
			$url = url_new_replace($rs['url'], $webInfo['url_type'], $webInfo['web_domain']);
		
			$str.='<li><a href="'.$url.'">'.$rs['cat_title'].'</a></li>' ;
		}
		
		unset($rs);
		return $str;	
	
	}
	
	/**
	* 得到   所有所有一级分类
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getDefiniteAllOneCategory($get = array() ) {
		
		$str = '';
		$cat_id = trim($get['产品分类ID']);
		$arr = $this->definiteAllOneCategory($get);
		$webInfo = $arr['webInfo'];
		
		$result = $GLOBALS['db']->query($arr['sql']);
		
		while ($rs = $GLOBALS['db']->fetch_array($result)) {
			
			$url = url_new_replace($rs['url'], $webInfo['url_type'], $webInfo['web_domain']);
			$li_select_css = '';
			
			if ($cat_id == $rs['cat_id']) {
				$li_select_css = 'class="curr"';
			}
			
			$str .= '<li '.$li_select_css.'><a href="'.$url.'">'.$rs['cat_title'].'</a></li>' ;
		}
		unset($rs);
		return $str;	
	
	}
	
	/**
	* 得到   二级分类以及相关产品
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getTwoCategoryRelatedProducts($get = array() ) {
		
		$str = '';
		$cat_id =  trim($get['产品分类ID']);
		$arr = $this->twoCategoryRelatedProducts($get);
		$webInfo = $arr['webInfo'];
		
		$res1 = $GLOBALS['db']->query($arr['sql']);
		while ($row1 = $GLOBALS['db']->fetch_array($res1)) {
			
			$sql = "SELECT p.product_name,p.product_box_middle,tab.url 
					FROM won_product won_p 
					LEFT JOIN product p ON p.product_id = won_p.won_product_id 
					LEFT JOIN category cat ON cat.cat_id = won_p.cat_id 
					LEFT JOIN Table_{$webInfo['products_info']['table']} tab ON tab.Field_{$webInfo['products_info']['pId']} = won_p.id 
					WHERE FIND_IN_SET('{$row1['cat_id']}',cat.parent_path) AND cat.cat_type = 2 AND cat.cat_web = '{$webInfo['web_fage']}' 
						  AND cat.is_delete =0 AND won_p.won_product_delete = 0 AND cat.cat_series = 3 {$webInfo['products_category']['whereRelatedProducts']} 
					ORDER BY won_p.is_emphasis DESC ";
			
			$res2 = $GLOBALS['db']->query($sql);
			
			$num = $GLOBALS['db']->num_rows($res2);
			$j = 0;
			$i = 0;
			$str_more1 = $str_more2 = '' ;
			$str_5_product = '';
			$average = ($num - 5) / 2;
			while ($row2 = $GLOBALS['db']->fetch_array($res2)) {
				
				$url = url_new_replace($row2['url'], $webInfo['url_type'], $webInfo['web_domain']);
				if ($i < 5) {
					$str_5_product .= '<div class="item"><a href="'.$url.'"><img src="'.$row2['product_box_middle'].'" 
					height="105" />  <span>'.$row2['product_name'].'</span></a></div>';
				}
				
				if ($i >= 5) {
					if ($j < $average) {
						$str_more1.='<li><a href="'.$url.'">'.$row2['product_name'].'</a></li>';
					
					} else {
						$str_more2.='<li><a href="'.$url.'">'.$row2['product_name'].'</a></li>';
					}
					
					$j = $j + 1;
				}
				$i = $i + 1;
			}
			
			if ($num > 0) {
				$str .= '<div class="title1"><h2>'.$row1['cat_title'].'</h2></div><div  
				class="probox">'.$str_5_product.'<div class="clear"></div></div>';
				if (!empty($str_more2)) {
					$str_more2 = ' <ul class="list fr">'.$str_more2.'</ul>';
				}
				
				if (!empty($str_more1)) {
					$str_more1 = '<div class="newsbox"><h3 class="tit">More Product</h3><ul 
					class="list fl">'.$str_more1.'</ul>'.$str_more2.'<div class="clear"></div></div>';   
				}   
				$str .= $str_more1;
			}
				
			
		}
		unset($row2, $row1);
		return $str;
	}
	
	/**
	* Order分类以及文章列表
	* @param   array      		 $get       字段数组
	* @return  string
	* @return  array
	*/
	function getOrderCategoryArticleList($get = array() ) {
		
		$str ='';
		$arr = $this->orderCategoryArticleList($get);
		$webInfo = $arr['webInfo'];	

		$rows = $GLOBALS['db']->getAll($arr['sql']);
		foreach ($rows AS $values) {
			
			$str .= '<h2> '.$values['type_name'].'</h2><div class="toggle-item">';
			$sql = "SELECT * 
					FROM ( (
					SELECT new.id , new.title,tab.url 
					FROM faq_info_new new 
					LEFT JOIN Table_{$webInfo['order_info']['table']} tab ON tab.Field_{$webInfo['order_info']['temKey']} = new.id 
					WHERE new.id IN (
					    SELECT id 
					    FROM faq_operation_types 
					    WHERE web_type = '{$webInfo['web_fage']}' AND is_important = 1 ) AND new.type_id = '{$values['type_id']}' AND new.web_type = '{$webInfo['web_fage']}' ) 
					UNION ALL (
					SELECT new.id , new.title,tab.url 
					FROM faq_info_new new 
					LEFT JOIN Table_{$webInfo['order_info']['table']} tab ON tab.Field_{$webInfo['order_info']['temKey']} = new.id 
					WHERE new.id NOT IN (
					    SELECT id 
					    FROM faq_operation_types 
					    WHERE web_type = '{$webInfo['web_fage']}' AND is_important = 1 ) AND new.type_id = '{$values['type_id']}' AND new.web_type = '{$webInfo['web_fage']}' 
					ORDER BY new.id ) ) newFaq LIMIT 4 ";
			
			$result = $GLOBALS['db']->query($sql);
			
			$sql = "SELECT url 
					FROM Table_{$webInfo['order_category']['table']} 
					WHERE Field_{$webInfo['order_category']['categoryName']} = '{$values['type_name']}' ";
			
			$url_type = url_new_replace($GLOBALS['db']->getOne($sql), $webInfo['url_type'], $webInfo['web_domain']);
			$nums = 0;
			
			while ($rs = $GLOBALS['db']->fetch_array($result)) {
				
				$url = url_new_replace($rs['url'], $webInfo['url_type'], $webInfo['web_domain']);
				$str .= '<p class="question">▪ <a href="'.$url.'">'.$rs['title'].'</a></p>';
				$nums ++;
			}
			if ($nums == 4) {
				$str .= ' <div class="mt10 ml20"><a href="'.$url_type.'" >More about '.$values['type_name'].' >></a></div><br /><br />'; 
			}
			$str .= '</div>';
		}
		unset($rs, $rows);
		return $str;
	}
	
	/**
	* 右侧文章以及随机文章
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getProductRightArticle($get = array() ) {
			
		$str = '';
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		$a_id = (int) $get["文章ID"];
		$ws_id = (int) $get['产品ID'];
		
		if (!empty($a_id)) {
			$sql = "SELECT version_id 
					FROM faq_info_new 
					WHERE id = {$a_id} AND web_type = '{$webInfo['web_fage']}' ";
			
			$version_id  = $GLOBALS['db']->getOne($sql);
	
			$sql = "SELECT won_p.id 
					FROM version v,product p ,won_product won_p 
					WHERE v.product_id = p.product_id AND won_p.won_product_id = p.product_id 
						AND FIND_IN_SET(v.version_id,'{$version_id }') {$webInfo['products_category']['whereRelatedProducts']} LIMIT 1 ";			
			$ws_id  = $GLOBALS['db']->getOne($sql);
		}
		
		if (!empty($ws_id)) {
			$recommend_article_str = ''; $nums = 0;$arr = array();
			//以下是得到产品相关分类的产品推荐文章ID组合
			$sql = "SELECT su.recommend_article,su.topic_cat_id 
					FROM support_right_recommend su 
					LEFT JOIN category cate ON su.p_cat_id = cate.parent_id 
					LEFT JOIN won_product won_p ON won_p.cat_id = cate.cat_id 
					WHERE won_p.id = {$ws_id} ";
			$row = $GLOBALS['db']->getOneRs($sql);
			
			if(empty($row)) {
				return '';
			}
				
			$arr = explode(',', $row['recommend_article']);
			
			$topic_cat_id = (int) $row['topic_cat_id'];
			sort($arr);
			//以下是最多取6条文章
			foreach ($arr AS $key=>$values) {
				
				if ($key == 0) {
					$recommend_article_str = $values;
				} else if ($key == 6) {
					break;
				} else {
					$recommend_article_str .= ','.$values;
				}
			}
			
			$nums = count($arr) ;
			//以下是取推荐文章信息
			$sql = "SELECT ar.ar_id,ar.ar_subtitle,tab.url 
					FROM topic_article ar 
					LEFT JOIN Table_{$webInfo['article']['table']} tab ON tab.Field_{$webInfo['article']['temKey']} = ar.ar_id 
					WHERE FIND_IN_SET(ar_id,'{$recommend_article_str}') ";
			
			$result = $GLOBALS['db']->query($sql);
			while ($row = $GLOBALS['db']->fetch_array($result)) {
				
				$url = $row['url'];
				if (empty($url) && $webInfo['is_article_single_page'] == 1) {
					$sql = "SELECT url 
							FROM Table_{$webInfo['single_article']['table']} 
							WHERE Field_{$webInfo['single_article']['temKey']} = '{$row['ar_id']}'";
					
					$url = $GLOBALS['db']->getOne($sql);
				}	
				$url = url_new_replace($url, $webInfo['url_name']);
				$str .= '<li><a href="'.$url.'" >'.$row['ar_subtitle'].'</a></li>';
			}
	
			//如果推荐文章木有六条则随机取6-推荐的文章数量
			if ($nums < 6) {
				//以下是判断随机表里是否存在
				$sql = "SELECT rand_article_id 
						FROM support_rand_article 
						WHERE rand_ws_id = {$ws_id} AND recommend_id = '{$recommend_article_str}'";
				
	
				$rows = $GLOBALS['db']->getAll($sql);
				$type = '';
				//如果不存在则随机取产品相关分类的文章产品6-推荐的文章数量 条数
				if (empty($rows[0]) && !empty($topic_cat_id)) {
			
						$sql = "SELECT ar.ar_id,ar.ar_subtitle,tab.url 
								FROM topic_article ar 
								LEFT JOIN Table_{$webInfo['article']['table']} tab ON tab.Field_{$webInfo['article']['temKey']} = ar.ar_id 
								WHERE ar.web_type = '{$webInfo['web_fage']}' AND ar.is_delete = 0 AND ar_cat_id = {$topic_cat_id} 
								ORDER BY RAND() LIMIT ".(6 - $nums );
						
						$type = 'insert';//表示为新增到随机表中 保持每次发布时  随机文章不变
				
				} else {
					$sql = "SELECT ar.ar_id,ar.ar_subtitle,tab.url 
							FROM topic_article ar 
							LEFT JOIN Table_{$webInfo['article']['table']} tab ON tab.Field_{$webInfo['article']['temKey']} = ar.ar_id 
							WHERE FIND_IN_SET(ar_id,'{$rows[0]['rand_article_id']}') ";
					
				}
				
				$rand_article_id = '';
				$result = $GLOBALS['db']->query($sql);
				
				while ($row = $GLOBALS['db']->fetch_array($result)) {
					
					$url = $row['url'];
					if (empty($url) && $webInfo['is_article_single_page'] == 1) {
						$sql = "SELECT url 
								FROM Table_{$webInfo['single_article']['table']} 
								WHERE Field_{$webInfo['single_article']['temKey']} = '{$row['ar_id']}' ";
						
						$url = $GLOBALS['db']->getOne($sql);
					}
					
					$rand_article_id .= empty($rand_article_id) ? $row['ar_id'] : ','.$row['ar_id'];
					$url = url_new_replace($url, $webInfo['url_name']);
					
					$str .= '<li><a href="'.$url.'" >'.$row['ar_subtitle'].'</a></li>';
				}
				
				if ($type == 'insert') {
					$sql = "DELETE FROM support_rand_article WHERE rand_ws_id = {$ws_id} ";
					$GLOBALS['db']->query($sql);
					
					$sql = "INSERT INTO support_rand_article(rand_ws_id,recommend_id,rand_article_id) 
							VALUES ({$ws_id},'{$recommend_article_str}','{$rand_article_id}')";
					$GLOBALS['db']->query($sql);
				}
			}
			unset($row);
		}
	
		if ($str == "") {
			return '';
		}
		
		return ' <div class="title1"><h2> Additional Resource </h2></div><div class="bg1">
		<ul class="n_list1" style="line-height:40px;" >'.$str.'</ul></div>';
	
	}
	
	/**
	*  得到产品视频弹出代码
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getProductVideoPopupHtml($get = array() ) {
		
		$ws_id = (int) $get['产品ID'];
		$sql = "SELECT won_product_id 
				FROM won_product 
				WHERE id = {$ws_id} ";
		$product_id   = $GLOBALS['db']->getOne($sql);
		
		$str_prefix = '<script type="text/javascript" src="http://images.wondershare.com/script/jquery.fancybox-1.3.2.js"></script>
						<link rel="stylesheet" type="text/css" href="http://images.wondershare.com/script/jquery.fancybox-1.3.2.css" media="screen" />
						<link href="http://images.wondershare.com/style/tipswindown.css" rel="stylesheet" type="text/css" media="screen" />
						<script type="text/javascript" src="http://images.wondershare.com/script/tipswindown.js"></script>
						<script type="text/javascript" src="http://www.wondershare.com/script/swfobject.js"></script>
						<script type="text/javascript"> 
						function winown_pop(url,extension)
						{
							add_flashvideo(url,extension);
							tipsWindown("title","id:flashvideo","550","400","true","","true","id");
						}';
		$str_suffix ='</script><div id="pop_video" style="display:none"></div>';
		$str = '';

		$sql = "SELECT version_id 
				FROM version 
				WHERE product_id = '{$product_id}' AND is_sale = 1 LIMIT 1";
		
		$version_id = $GLOBALS['db']->getOne($sql);
		if (!empty($version_id)) {
			
			$sql  = "SELECT content 
					FROM online_help 
					WHERE FIND_IN_SET('{$version_id}',version_id) AND is_video = 1 AND web_type = '{$webInfo['web_fage']}' LIMIT 1 ";
			$content = $GLOBALS['db']->getOne($sql);
			
			if (!empty($content)) {
				$video_arr = explode('.', $content);
				$video_type = $video_arr[count($video_arr)-1];//得到文件类型
				if ($video_type == 'swf') {
					$str = $str_prefix.'   function insert_swf(url)
					{
						var s5 = new SWFObject(url,"mediaplayer","500","300","8");
						s5.addParam("allowfullscreen","true");
						s5.addVariable("width","500");
						s5.addVariable("height","300");
						s5.addVariable("file",url);
						s5.addVariable("backcolor","0xff8c00");
						s5.addVariable("frontcolor","0xE2F0FE");
						s5.write("flashvideo");
					}
					function add_flashvideo(url,extension)
					{
						$("#pop_video").html("");
						$("#flashvideo").remove();
						var str = "";
						str = \'<div id="flashvideo" style="display:none">Flvplayer</div>\';
						$("#pop_video").html(str);
						insert_swf(url);
					}'.$str_suffix;
				} else if ($video_type == 'flv') {
					$str = $str_prefix.'   function insert_flv(url)
							{
								var s5 = new SWFObject("http://www.wondershare.com/pro/demo/FlvPlayerV2009.swf","mediaplayer","500","300","8");
								s5.addParam("allowfullscreen","true");
								s5.addVariable("width","500");
								s5.addVariable("height","300");
								s5.addVariable("file",url);
								s5.addVariable("backcolor","0xff8c00");
								s5.addVariable("frontcolor","0xE2F0FE");
								s5.addVariable("wmode","Opaque");
								s5.write("flashvideo");
							}
							function add_flashvideo(url,extension)
							{
								$("#pop_video").html("");
								$("#flashvideo").remove();
								var str = "";
								str = \'<div id="flashvideo" style="display:none">Flvplayer</div>\';
								$("#pop_video").html(str);
								insert_flv(url);
							}'.$str_suffix;
				} else if ($video_type  == "mov" || $video_type == "m4v") {
					$str = $str_prefix.'  
							function add_flashvideo(url,extension)
							{
								$("#pop_video").html("");
								$("#flashvideo").remove();
								var str = "";
								str=\'<div style="display:none" id="flashvideo">\'+
								\'<embed src="\'+url+\'" width="500" height="350"></embed>\'+
								\'</div>\';
								$("#pop_video").html(str);
							} '.$str_suffix;
				}
			}
		}
		return $str;
		
	}
	
	/**
	*得到四条快捷记录与视频代码
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function  getProductQuickRecord($get = array() ) {
		
		$str = '';
		$product_name =  trim($get["产品名称"]);
		$ws_id = (int) $get["产品ID"];
		$arr = $this->productQuickRecord($get);
		$webInfo = $arr['webInfo'];	
	
		$sql = "SELECT won_product_id FROM won_product WHERE id = {$ws_id} ";
		$product_id   = $GLOBALS['db']->getOne($sql);
		
		if (!empty($arr['help_url'])) {
			$url = url_new_replace($arr['help_url'], $webInfo['url_type'], $webInfo['web_domain']);
		
			$str .= '<li><a href="'.$url.'"  class="icon1"  >'.$product_name.' getting started</a></li>';
		
		}

		$row = $GLOBALS['db']->getOneRs($arr['sql_v']);
		if (!empty($row)) {
			$str .='<li><a href="'.$row['download_url'].'"  class="icon2" >Download '.
					$product_name.' V'.$row['version_name'].'</a></li>';
		}
		
		if (!empty($arr['p_url'])) {
			$p_url = url_new_replace($arr['p_url'], $webInfo['url_name'], $webInfo['web_domain']);
			$str.='<li><a href="'.$p_url.'"  class="icon4" >View Detail of '.$product_name.'</a></li>';
		}
		
		//以下是视频处理
		$str_v = '';
		$j = 0;
		$sql = "SELECT version_id 
				FROM version 
				WHERE product_id = '{$product_id}' 
				ORDER BY version_name DESC ";
		$result = $GLOBALS['db']->query($sql);
		
		while ($row = $GLOBALS['db']->fetch_array($result)) {
			if ($j >=1 ) {
				break;
			}
			
			$sql  = "SELECT content 
					FROM online_help 
					WHERE FIND_IN_SET('{$row['version_id']}',version_id) AND is_video = 1 AND web_type = '{$webInfo['web_fage']}' LIMIT 1 ";
			$content = $GLOBALS['db']->getOne($sql);
			
			if (!empty($content)) {
				$video_arr = explode('.', $content);
				$video_type = $video_arr[count($video_arr)-1];//得到文件类型
				$str_v = '<div class="frbox" onclick=\'winown_pop("'.$content.'","'.$video_type.'")\'><div class="pic"><span class="btn">
						<a href="javascript:void(0)" id="link1" class="watch" onclick=\'winown_pop("'.$content.'","'.$video_type.'")\' >Watch Demo</a></span>
						<img src="../images/pic2.jpg" width="150" height="108" /></div>
						<p class="bt">'.$product_name .' guide demo</p> </div>';
				$j++;
			}
		
		}
		
		$str  = empty($str) ? '' : '<ul class="text">'.$str.'</ul>';
		if (!empty($str) || !empty($str_v)) {
			$str = '<div class="videobox">'.$str.' <div class="clear"></div></div>';
		}
		unset($row);
		return  $str;
	}
	
	/**
	* 得到产品相关FAQ文章
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getProductRelatedFaqArticle($get = array() ) {
		
		$arr = $this->productRelatedFaqArticle($get);
		
		$webInfo = $arr['webInfo'];	
		$res = $GLOBALS['db']->query($arr['sql']);
		
		$nums = 0;
		while ($values = $GLOBALS['db']->fetch_array($res)) {
			
			if (!empty($values['title'])) {
				$url = url_new_replace($values['url'], $webInfo['url_type'], $webInfo['web_domain']);
	
				$title = $values['title'];
				if (strlen($title) > 80) {
					$title = substr($title, 0, 80).'...' ;
				}
				
				$bg_class = '';
				if ($i % 2 == 0) {
					$bg_class = 'class="bg"';
				}
					
				$str .= '<li '.$bg_class.'><a href="'.$url.'" title ="'.htmlspecialchars($values['title']).'" >'.
						$title.'</a></li>';	
				$i++;
				$nums++;
			}
		
		}
		
		if ($nums == 0) {
			return '';
		}
		
		if ($nums == 10) {
			$str_more = '<p class="frmore2"><a href="'.$arr['moreUrl'].'">More >></a></p>';
		}
		
		$str = '<div class="title1">
				<h2>How-tos and Troubleshooting</h2>
				</div><ul class="n_list1">'.$str.'</ul>'.$str_more;
		
		unset($row);
		return $str;
		
	}
	
	/**
	* 得到产品community_js代码
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getProductCommunityJs($get = array() ) {
		
		$str = "";
		$community_name = trim($get["community_产品"]);
		$community_start_name = trim($get["community_产品"]);
		if (!empty($community_name)) {
			
			$community_name = str_replace('&', '', str_replace('/', '', strtolower($community_name)));
			$community_name = 'wondershare_'.preg_replace('/\s/is','_', $community_name);
			$more_url = 'http://community.wondershare.com/wondershare/products/'.$community_name;
			$str = '<div style="border-top:1px dashed #DEDEDE;margin: 30px 0 0;padding:0 0 15px;"></div><div id="gsfn_list_widget">
					<a href="'.$more_url.'" class="widget_title" target="_blank" >Hot Forum Topics about '.$community_start_name.'</a>
					<p>See what other Wondershare customers are talking about,and get answers from the wondershare Q&A Forum.</p>
					<div id="gsfn_content">Loading...</div>
					<div class="powered_by">
					<a href="'.$more_url.'" class="fr" target="_blank" >more &gt;&gt;</a></div>
					</div>
					<script        
					src="https://getsatisfaction.com/wondershare/widgets/javascripts/afd66e1158/widgets.js"   
					type="text/javascript"></script>
					<script 
					src="https://getsatisfaction.com/wondershare/topics.widget?callback=gsfnTopicsCallback&amp;length=0&amp;limit=3&amp;product='.$community_name.'&amp;sort=recently_active&amp;style=question" type="text/javascript"></script>';
		
		}
		return $str;
		
	}
	
	/**
	* 得到产品对应其他文章
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getProductRelativeOtherArticle($get = array() ) {
		
		$str = '';
		$arr = $this->productRelativeOtherArticle($get);
		$webInfo = $arr['webInfo'];	
		
		$res = $GLOBALS['db']->query($arr['sql']);
		$i = 0;
		$find_str = 0;
	
		while ($row = $GLOBALS['db']->fetch_array($res)) {
			
			if ($i >= 3) {
				break; 
			}
			$sql = "SELECT faq.title,tem.url,faq.id 
					FROM Table_{$webInfo['faq_info']['table']} AS tem 
					LEFT JOIN faq_info_new AS faq ON faq.id = tem.Field_{$webInfo['faq_info']['temKey']} 
					WHERE !FIND_IN_SET(faq.id,'{$find_str}') AND FIND_IN_SET('{$row['version_id']}',faq.version_id) AND faq.web_type = '{$webInfo['web_fage']}' LIMIT 3 " ;			
			$result = $GLOBALS['db']->query($sql);
			
			while ($rs = $GLOBALS['db']->fetch_array($result)) {
				
				if ($i >= 3) {
					break; 
				}
				
				$url = url_new_replace($rs['url'], $webInfo['url_type'], $webInfo['web_domain']);
				$rs['sub_title'] = strlen($rs['title']) > 110 ? substr($rs['title'], 0, 110).'...' : $rs['title'];
				$str .= '<li><a href="'.$url.'" title="'.$rs['title'].'">'.$rs['sub_title'].'</a></li>';  
				$find_str = $find_str.','.$rs['id'];
				$i++;
			}
		}
		if($i ==  0) {
			return '';
		}
		
		$str = '<div class="title1"><h2>Related</h2></div><ul class="n_list2">'.$str.'</ul>';
		unset($row, $rs);
		return $str;
	}
	
	/**
	* 得到FAQ对应其他文章
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getFaqRelativeOtherArticle($get = array() ) {
		
		$str = '';
		$arr = $this->faqRelativeOtherArticle($get);
		$webInfo = $arr['webInfo'];	
		
		$res = $GLOBALS['db']->query($arr['sql']);
		$find_str = trim($get["文章ID"]);
		$i = 0;
		
		while ($row = $GLOBALS['db']->fetch_array($res))  {
			
			if ($i >= 3) {
				break; 
			}
			
			$sql = "SELECT * 
					FROM ( ( 
					SELECT faq.title,tab.url,faq.id 
					FROM faq_info_new AS faq 
					LEFT JOIN Table_{$webInfo['faq_info']['table']} AS tab ON tab.Field_{$webInfo['faq_info']['temKey']} = faq.id 
					WHERE FIND_IN_SET('{$row['version_id']}',faq.version_id) AND faq.type_id = 6 AND !FIND_IN_SET(faq.id,'{$find_str}') AND faq.id IN (
					    SELECT id 
					    FROM faq_operation_types 
					    WHERE web_type = '{$webInfo['web_fage']}' AND is_important = 1 ) AND faq.web_type = '{$webInfo['web_fage']}' ) 
					UNION ALL ( 
					SELECT faq.title,tab.url,faq.id 
					FROM faq_info_new AS faq 
					LEFT JOIN Table_{$webInfo['faq_info']['table']} AS tab ON tab.Field_{$webInfo['faq_info']['temKey']} = faq.id 
					WHERE FIND_IN_SET('{$row['version_id']}',faq.version_id) AND faq.type_id = 6 AND !FIND_IN_SET(faq.id,'{$find_str}') AND faq.id NOT IN (
					    SELECT id 
					    FROM faq_operation_types 
					    WHERE web_type = '{$webInfo['web_fage']}' AND is_important = 1 ) AND faq.web_type = '{$webInfo['web_fage']}' ) ) faq_new LIMIT 3 ";		
			$result = $GLOBALS['db']->query($sql);
			
			while ($rs = $GLOBALS['db']->fetch_array($result)) {
				
				if ($i >= 3) {
					break; 
				}
				if (!empty($rs['url'])) {
					$url = url_new_replace($rs['url'], $webInfo['url_type'], $webInfo['web_domain']);
					
					$rs['sub_title'] = strlen($rs['title']) > 100 ? substr($rs['title'], 0, 100).'...' : $rs['title'];
					
					$str .= '<li><a href="'.$url.'" title="'.$rs['title'].'"  >'.$rs['sub_title'].'</a></li>';  
					$find_str = $find_str.','.$rs['id'];
					$i++;
				}
			}
		}
		
		if ($i ==  0) {
			return '';
		}
		$str = '<div class="title1"><h2>Related FAQ</h2></div><ul class="n_list2">'.$str.'</ul>';
		
		unset($row, $rs);
		return $str;
	}
	
	/**
	* 得到FAQ所属产品
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getFaqBelongToProduct($get = array() ) {
		
		$str = '';
		$arr = $this->faqBelongToProduct($get);
		$webInfo = $arr['webInfo'];	
		
		$res = $GLOBALS['db']->query($arr['sql']);
		while ($row = $GLOBALS['db']->fetch_array($res)) {
			
			$url = url_new_replace($row['url'], $webInfo['url_type'], $webInfo['web_domain']);
			$str .= '<li><a href="'.$url.'"> '.$row['product_name'].'</a></li>';
		}
		unset($row);
		return $str;
	}
	
	/**
	* 得到whatisnew_content内容
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getProductWhatisnewContent($get = array() ) {
		
		$str = '';
		$product_name = empty($get["ws产品名称"]) ? trim($get["产品名称"]) : trim($get["ws产品名称"]);
		$arr = $this->productWhatisnewContent($get);
		$webInfo = $arr['webInfo'];	
		$rows = $GLOBALS['db']->getAll($arr['sql']);
		
		$i = 1;
		foreach ($rows AS $key => $values) {
			
			$whatisnew_content= str_replace("\n", " <br>", $values['whatisnew_content']);
			if ($i % 2 == 0) {
				$str .= '<dt class="slide">';
			} else {
				$str .= '<dt class="slide bg">';
			}
			$str .= '<a href="#" class="btn-slide'.$i.'" title="'.$i.'">'.$product_name.$values['version_name'].' is Released. '.'('.$values['publish_date'].')</a></dt>
					<dd id="panel'.$i.'" >'.$whatisnew_content.'</dd>';
			$i++;
		}
				
		unset($rows);
		return $str;
	}
	
	/**
	* 得到history对应其他文章
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getHistoryRelativeOtherArticle($get = array() ) {
		
		$str = '';
		$arr = $this->historyRelativeOtherArticle($get);
		$webInfo = $arr['webInfo'];	
		
		$result = $GLOBALS['db']->query($arr['sql']);
		while ($rs = $GLOBALS['db']->fetch_array($result)) {
			
		  $url = url_new_replace($rs['url'], $webInfo['url_type'], $webInfo['web_domain']);
		  $str .= '<li><a href="'.$url.'" >'.$rs['title'].'</a></li>';  
		}
		unset($rs);
		return $str;
	}
	
	/**
	* 得到地图Order分类列表
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getMapOrderCategoryList($get = array() ) {
		
		$str = '';
		$arr = $this->mapOrderCategoryList($get);
		$webInfo = $arr['webInfo'];	
		
		$result = $GLOBALS['db']->query($arr['sql']);
		while ($rs = $GLOBALS['db']->fetch_array($result)) {
			
			$url = url_new_replace($rs['url'], $webInfo['url_type'], $webInfo['web_domain']);
			$str .= '<dd><a href="'.$url.'">'.$rs['type_name'].'</a></dd>';
		}
		unset($rs);
		return $str;
	}
	
	/**
	* 得到地图产品所有一级分类
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getMapAllProductCategory($get = array() ) {
		
		$str =  '';
		$arr = $this->mapAllProductCategory($get);
		$webInfo = $arr['webInfo'];	
		
		$result = $GLOBALS['db']->query($arr['sql']);
		while ($rs = $GLOBALS['db']->fetch_array($result)) {
			
			$select_css = '';
			$url = url_new_replace($rs['url'], $webInfo['url_type'], $webInfo['web_domain']);
			
			$str .= '<dd ><a href="'.$url.'">'.$rs['cat_title'].'</a></dd>' ;
		}
		return $str;	
	}
	
	/**
	* 得到是否有在线帮助
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getProductOnhelpHref($get = array() ) {
		
		$str =  '';
		$arr = $this->productOnhelpHref($get);
		//表示为Table_91表
		$li_select_css = '';
		if ($get['TID'] == 91 ) {
			$li_select_css = 'class="curr"';
		}
				
		if (!empty($arr['url'])) {
			 return '<li '.$li_select_css.'><a  href="'.$arr['url'].'">Getting Started</a></li>';
		} else {
			return '';
		}
	}
	
	/**
	* 得到是否有视频
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getProductVideoHref($get = array() ) {
		
		$webInfo =  $this->getWebInfo($get['web_type']);//根据网站得到相应的信息
		$p_id =  trim($get['产品ID']);
		$url =  $this->getSingleHerf($webInfo['products_video_info']['table'],
									$webInfo['url_type'],$webInfo['web_domain'],
									' WHERE Field_'.$webInfo['products_video_info']['pId'].' = '.$p_id);
		if (!empty($url)) {
			 return '<li><a href="'.$url.'">Video Tutorial</a></li>';
		} else {
			return '';
		}
	}
	
	/**
	* 得到是否有Troubleshooting
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getProductHowtosHref($get = array() ) {
		
		$arr = $this->productHowtosHref($get);
		$li_select_css = '';
		//表示为Table_90表
		if ($get['TID'] == 90 ) {
			$li_select_css = 'class="curr"';	
		}
		
		if (!empty($arr['url'])) {
			 return '<li '.$li_select_css.' ><a  href="'.$arr['url'].'">'.'How-to & Troubleshooting</a></li>';
		} else {
			return '';
		}
	
		
	}
	/**
	* 得到Products-Support-TroubleshootingFAQ   生成分页
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getHowTosCreatePage($get = array() ) {
		
		$arr = $this->howTosCreatePage($get);
		$webInfo = $arr['webInfo'];
		$total = $arr['total'];
		$max_page = $arr['max_page'];
		$dirurl = $arr['dirurl'];
		$dir = $arr['dir'];
		$template_str = $arr['template_str'];
		$all = $arr['all'];
		
		for ($i = 1; $i <= $max_page; $i++)  {
			$list = '';
			$temp = $template_str;
			$page_start = ($i - 1) * 10 + 1;
			$page_end = ($i - 1) * 10 + 10;
			
			if ($page_end >= $total) {
				$page_end = $total;
			}
			
			$chang_sum = 0;
			$k = 0;
			for ($j = ($i - 1)* 10; $j <= $i * 10 - 1; $j++)  {
				
				if ($j >= $total) {
					break;   
				}
				$url = url_new_replace($all[$j]['url'], $webInfo['url_type'], $webInfo['web_domain']);
			
				if ($k % 2 == 0) {
					$list .= '<div class="item">';
				} else {
					$list .= '<div class="item bg">';
				} 
				
				if (strlen($all[$j]['title']) > 87) {
					$all[$j]['s_title'] = substr($all[$j]['title'], 0, 87).'...';
				} else {
					$all[$j]['s_title'] = $all[$j]['title'];
				}
				
				$chang_sum = $chang_sum + 1;
				$list .= '<img src="../../images/other_03.png"  
						width="45" height="42" class="fl" /><dl class="text"><dt><a href="'.      
						$url.'" title="'.$all[$j]['title'].'" >'.$all[$j]['s_title'].'</a></dt><dd>'.$all[$j]['description'].'</dd></dl></div>';
				$k = $k + 1;
			}
			
			if ($total > 10) {
				//分页
				$page = '<div id="page">';
				if ( $i  > 1 ) {
					if ($i -1 == 1) {
						$page .= '<a href="'.'../../'.$dirurl.'/" > Prev Page</a>';
					} else {
						$page .= '<a href="'.'../../'.$dirurl.'/'.($i - 1).'.html" >Prev Page</a>';
					}
				} else {
					$page .= '<a >< prev page</a>';
				}
				
				$start = $i - 4;
				$end = $i + 4;
				
				if ($start < 1) {
					$start = 1; $end = 6;
				}
					
				if ($end > $max_page) {
					$end = $max_page; $start = $max_page - 5;
				}
				
				if ($start < 1){
					$start = 1;
				}
				
				if ($start != 1){
					$output .= '';
				}
				
				for ($start; $start <= $end; $start++) {
					
					if ($i == $start) {
						$page .= '<a class="now_page" >'.$start.'</a>';
					} else {
						if ($start == 1) {
							$page .= '<a href="'.'../../'.$dirurl.'/">'.$start.'</a>';
						}else{
							$page .= '<a href="'.'../../'.$dirurl.'/'.$start.'.html">'.$start.'</a>';
						}
					}
				}
				
				if ($end != $max_page) {
					$output .= '';
				}
				
				if ($i < $max_page) {
					$page .= '<a href="'.'../../'.$dirurl.'/'.($i + 1).'.html" >Next Page</a>';
				} else {
					$page .= '<a >Next Page</a>';
				}
				
				$page .= '</div><div class="fr">Results '.$page_start.' - '.$page_end.'  of '.$total.'</div>
				<div class="clear"></div>';
			}
			
			$page = '<div class="helist">'.$list.'</div>'.$page;//列表与分页div合并
			//预览
			if ($get['do'] == 'view') {
				return $page;
			}
			
			$temp = str_replace('<!--page_module-->', $page, $temp);
			$temp = str_replace('$'.'{HowTos列表和分页信息}', '', $temp);
		
			$temp = str_replace('$'.'{页面关键字}', $get['页面关键字'], $temp);
			$temp = str_replace('$'.'{所有一级分类}', $this->getAllOneCategory($get), $temp);
			$temp = str_replace('$'.'{页面描述}', $get['页面描述'], $temp);
				
			$temp = str_replace('$'.'{OrderSupport首页链接}', $this->getOrderIndexHref($get), $temp);
			$temp = str_replace('$'.'{ProductsSupport首页链接}', $this->getProductsIndexHref($get), $temp);
			$temp = str_replace('$'.'{所有下载链接}', $this->getAllDownloadHref($get), $temp);
			
			$temp = str_replace('$'.'{页面标题}', $get['页面标题'].' of '.$i, $temp);
			$temp = str_replace('$'.'{所有视频链接}', $this->getAllVideoHref($get), $temp);
			
			$temp = str_replace('$'.'{Troubleshooting链接}', $this->getHowTosHref($get), $temp);
			$temp = str_replace('$'.'{GettingStarted链接}', $this->getGettingStartedHref($get), $temp);
			$temp = str_replace('$'.'{登录html}', $this->getLoginHtml($get), $temp);
			$temp = str_replace('$'.'{登录js}', $this->getLoginJs($get), $temp);
			$temp = str_replace('$'.'{头文件}', $this->headerFile($get), $temp);
			$temp = str_replace('$'.'{脚文件}', $this->footerFile($get), $temp);
			
			$str_link  = '';
			
			if ($max_page == 1) {
				$temp = str_replace('$'.'{link代码}', $str_link, $temp);
			} else if ($i == 1 ) {
				$str_link = '<link rel="next" href="'.'../../'.$dirurl.'/'.($i + 1).'.html"/>';
				$temp = str_replace('$'.'{link代码}', $str_link, $temp);
			} else if ($i > 1 && $i < $max_page) {
				
				$str_link = '<link rel="canonical" href="'.'../../'.$dirurl.'/'.'"/>';
				
				if (( $i- 1) == 1) {
					$str_link .= '<link rel="prev" href="'.'../../'.$dirurl.'/"/>';
				} else {
					$str_link .= '<link rel="prev" href="'.'../../'.$dirurl.'/'.($i - 1).'.html"/>';
				}
				
				$str_link .= '<link rel="next" href="'.'../../'.$dirurl.'/'.($i + 1).'.html"/>';
				$temp = str_replace('$'.'{link代码}', $str_link, $temp);
			} else if ($i == $max_page) {
				
				$str_link = '<link rel="canonical" href="'.'../../'.$dirurl.'/'.'"/>';
				if (($i - 1) == 1) {
					$str_link .= '<link rel="prev" href="'.'../../'.$dirurl.'/"/>';
				} else {
					$str_link .= '<link rel="prev" href="'.'../../'.$dirurl.'/'.($i - 1).'.html"/>';
				}
				$temp = str_replace('$'.'{link代码}',$str_link,$temp);
			}
			if ($i == 1) {
			
				file_put_contents($dir.'/index.html', $temp);
			
			} else {
				
				file_put_contents($dir.'/'.$i.'.html', $temp);
			}

			

		}
	
		
	}
	
	/**
	* 得到在线帮助 生成分页
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getOnHelpCreatePage($get = array() ) {
		
		$arr = $this->onHelpCreatePage($get);
		$webInfo = $arr['webInfo'];
		$total = $arr['total'];
		$max_page = $arr['max_page'];
		$dirurl = $arr['dirurl'];
		$dir = $arr['dir'];
		$template_str = $arr['template_str'];
		$all = $arr['all'];
		
		for ($i = 1; $i <= $max_page; $i++) {
			
			$list = '';
			$temp = $template_str;
			$page_start=($i - 1) * 10 + 1;
			$page_end=($i - 1) * 10 + 10;
			
			if ($page_end >= $total) {
				$page_end = $total;
			}
			
			$chang_sum = 0;
			$k = 0;
			for ($j = ($i - 1)* 10; $j <= $i * 10 - 1; $j++) {
				
				if ($j >= $total) {
					break;   
				}
				$url = url_new_replace($all[$j]['url'], $webInfo['url_type'], $webInfo['web_domain']);
				
				if ($k % 2 == 0) {
					$list .= '<div class="item">';
				} else {
					$list .= '<div class="item bg">';
				} 
				$chang_sum = $chang_sum + 1;
				$list .= '<img src="../../images/other_03.png"  
						width="45" height="42" class="fl" /><dl class="text"><dt><a href="'.      
						$url.'">'.$all[$j]['title'].'</a></dt><dd>'.$all[$j]['description'].'</dd></dl></div>';
				$k = $k + 1;
			}
			
			if ($total > 10) {
				//分页
				$page = '<div id="page">';
				if ( $i  > 1 ) {
					if ($i -1 == 1) {
						$page .= '<a href="'.'../../'.$dirurl.'/" >Prev Page</a>';
					} else {
						$page .= '<a href="'.'../../'.$dirurl.'/'.($i - 1).'.html" >Prev Page</a>';
					}
				} else {
					$page .= '<a>Prev Page</a>';
				}
				
				$start = $i - 4;
				$end = $i + 4;
				
				if ($start < 1) {
					$start = 1; $end = 6;
				}
				
				if ($end > $max_page) {
					$end = $max_page; $start = $max_page - 5;
				}
				
				if ($start < 1) {
					$start = 1;
				}
				
				if ($start != 1) {
					$output .= '';
				}
				
				for ($start; $start <= $end; $start++) {
					
					if ($i == $start) {
						$page .= '<a class="now_page" >'.$start.'</a>';
					} else {
					  if ($start == 1) {
						$page .= '<a href="'.'../../'.$dirurl.'/">'.$start.'</a>';
					  }else{
						$page .= '<a href="'.'../../'.$dirurl.'/'.$start.'.html">'.$start.'</a>';
					  }
					}
				}
				
				if ($end != $max_page) {
					$output .= '';
				}
				
				if ($i < $max_page) {
					$page .= '<a href="'.'../../'.$dirurl.'/'.($i+1).'.html" >Next Page</a>';
				} else {
					$page .= '<a >Next Page</a>';
				}
				$page .= '</div><div class="fr">Results '.$page_start.' - '.$page_end.'  of '.$total.'</div>
						<div class="clear"></div>';
			}
			
			$page = '<div class="helist">'.$list.'</div>'.$page;//列表与分页div合并
			//预览
			if ($get['do'] == 'view') {
				return $page;
			}
			
			$temp = str_replace('<!--page_module-->', $page, $temp);
			$temp = str_replace('$'.'{列表和分页信息在线帮助}', '', $temp);
			
			$temp = str_replace('$'.'{页面关键字}', $get['页面关键字'], $temp);
			$temp = str_replace('$'.'{所有一级分类}', $this->getAllOneCategory($get), $temp);
			$temp = str_replace('$'.'{页面描述}', $get['页面描述'], $temp);
	
			
			$temp = str_replace('$'.'{OrderSupport首页链接}', $this->getOrderIndexHref($get), $temp);
			$temp = str_replace('$'.'{ProductsSupport首页链接}', $this->getProductsIndexHref($get), $temp);
			$temp = str_replace('$'.'{所有下载链接}', $this->getAllDownloadHref($get), $temp);
		
			$temp = str_replace('$'.'{页面标题}', $get['页面标题'].' of '.$i, $temp);
			$temp = str_replace('$'.'{所有视频链接}', $this->getAllVideoHref($get), $temp);
			

			$temp = str_replace('$'.'{Troubleshooting链接}', $this->getHowTosHref($get), $temp);
			$temp = str_replace('$'.'{GettingStarted链接}', $this->getGettingStartedHref($get), $temp);
			$temp = str_replace('$'.'{登录html}', $this->getLoginHtml($get), $temp);
			$temp = str_replace('$'.'{登录js}', $this->getLoginJs($get), $temp);
			$temp = str_replace('$'.'{头文件}', $this->headerFile($get), $temp);
			$temp = str_replace('$'.'{脚文件}', $this->footerFile($get), $temp);
			$str_link  = '';
			
			if ($max_page == 1) {
				$temp = str_replace('$'.'{link代码}', $str_link, $temp);
			} else if ($i == 1 ) {
			
				$str_link = '<link rel="next" href="'.'../../'.$dirurl.'/'.($i + 1).'.html"/>';
				$temp = str_replace('$'.'{link代码}', $str_link, $temp);
			} else if ($i > 1 && $i < $max_page) {
				
				$str_link = '<link rel="canonical" href="'.'../../'.$dirurl.'/'.'"/>';
				if (($i - 1) == 1) {
					$str_link .= '<link rel="prev" href="'.'../../'.$dirurl.'/"/>';
				} else {
					$str_link .= '<link rel="prev" href="'.'../../'.$dirurl.'/'.($i - 1).'.html"/>';
				}
				$str_link .= '<link rel="next" href="'.'../../'.$dirurl.'/'.($i + 1).'.html"/>';
				$temp = str_replace('$'.'{link代码}', $str_link, $temp);
			} else if ($i == $max_page) {
				$str_link = '<link rel="canonical" href="'.'../../'.$dirurl.'/'.'"/>';
				if (($i - 1) == 1) {
					$str_link .= '<link rel="prev" href="'.'../../'.$dirurl.'/"/>';
				} else {
					$str_link .= '<link rel="prev" href="'.'../../'.$dirurl.'/'.($i - 1).'.html"/>';
				}
				$temp = str_replace('$'.'{link代码}', $str_link, $temp);
			}
	
			if ($i == 1) {
				file_put_contents($dir.'/index.html', $temp);
			
			} else {
				file_put_contents($dir.'/'.$i.'.html', $temp);
			}
			
		}
		
	}
	
	/**
	* 得到在线帮助 生成分页
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getDownloadCreatePage($get = array() ) {
		
		$arr = $this->downloadCreatePage($get);
		$webInfo = $arr['webInfo'];
		$total = $arr['total'];
		$max_page = $arr['max_page'];
		$dirurl = $arr['dirurl'];
		$dir = $arr['dir'];
		$template_str = $arr['template_str'];
		$all = $arr['all'];
		
		for ($i = 1; $i <= $max_page; $i++)  {
			$list = '';
			$temp = $template_str;
			$page_start=($i-1) * 10 + 1;
			$page_end=($i-1) * 10 + 10;
			
			if ($page_end >= $total) {
				$page_end = $total;
			}
			
			$chang_sum = 0;
			$k = 0;
			
			for ($j = ($i - 1)* 10; $j <= $i * 10 - 1; $j++)  {
				
				if ($j >= $total) {
					break;   
				}
				$url = '';
				if ($k % 2==0) {
					$list .= '<div class="item">';
				} else {
					$list .= '<div class="item bg">';
				} 
				$chang_sum = $chang_sum + 1;
				$list .= '<img src="../../images/Download.png"  
						width="45" height="42" class="fl" /><dl class="text"><dt><a href="'.      
						$all[$j]['p_url'].'">'.$all[$j]['product_name'].'</a></dt><dd><strong>Version:</strong> 
						'.$all[$j]['version_name'].'</dd></dl><div class="btn"><a href="'.$all[$j]['download_url'].'" class="download"></a></div>
						<div class="clear"></div></div>';
				$k = $k +1;
			}

			if ($total > 10) {
				//分页
				$page = '<div id="page">';
				if ( $i  > 1 ) {
					if ($i -1 == 1) {
						$page .= '<a href="'.'../../'.$dirurl.'/" >Prev Page</a>';
					} else {
						$page .= '<a href="'.'../../'.$dirurl.'/'.($i - 1).'.html">Prev Page</a>';
					}
				} else {
					$page .= '<a>Prev Page</a>';
				}
				
				$start = $i - 4;
				$end = $i + 4;
				
				if ($start < 1) {
					$start = 1; $end = 6;
				}
				
				if ($end > $max_page) {
					$end = $max_page; $start = $max_page - 5;
				}
				
				if ($start < 1){
					$start = 1;
				}
				
				if ($start != 1){
					$output .= '';
				}
				
				for ($start; $start <= $end; $start++) {
					if ($i == $start) {
						$page .= '<a class="now_page" >'.$start.'</a>';
					} else {
						if ($start == 1) {
							$page .= '<a href="'.'../../'.$dirurl.'/">'.$start.'</a>';
						} else {
							 $page .= '<a href="'.'../../'.$dirurl.'/'.$start.'.html">'.$start.'</a>';
						}
					}
				}
				if ($end != $max_page) {
					$output .= '';
				}
				if ($i < $max_page) {
					$page .= '<a href="'.'../../'.$dirurl.'/'.($i + 1).'.html" >Next Page</a>';
				} else {
					$page .= '<a >Next Page</a>';
				}
				$page .= '</div><div class="fr">Results '.$page_start.' - '.$page_end.'  of '.$total.'</div>
				<div class="clear"></div>';
			}
			$page = '<div class="helist2">'.$list.'</div>'.$page;//列表与分页div合并
			//预览
			if ($get['do'] == 'view') {
				return $page;
			}
			
			$temp = str_replace('<!--page_module-->', $page, $temp);
			$temp = str_replace('$'.'{下载列表和分页信息}', '', $temp);
			
			$temp = str_replace('$'.'{页面关键字}', $get['页面关键字'], $temp);
			$temp = str_replace('$'.'{所有一级分类}', $this->getAllOneCategory($get), $temp);
			$temp = str_replace('$'.'{页面描述}', $get['页面描述'], $temp);

			
			$temp = str_replace('$'.'{OrderSupport首页链接}', $this->getOrderIndexHref($get), $temp);
			$temp = str_replace('$'.'{ProductsSupport首页链接}', $this->getProductsIndexHref($get), $temp);
			$temp = str_replace('$'.'{所有下载链接}', $this->getAllDownloadHref($get), $temp);
			$temp = str_replace('$'.'{页面标题}', $get['页面标题'].' of '.$i, $temp);
			$temp = str_replace('$'.'{所有视频链接}', $this->getAllVideoHref($get), $temp);
			
			$temp = str_replace('$'.'{Troubleshooting链接}', $this->getHowTosHref($get), $temp);
			$temp = str_replace('$'.'{GettingStarted链接}', $this->getGettingStartedHref($get), $temp);
			$temp = str_replace('$'.'{登录html}', $this->getLoginHtml($get), $temp);
			$temp = str_replace('$'.'{登录js}', $this->getLoginJs($get), $temp);
			
			$temp = str_replace('$'.'{头文件}', $this->headerFile($get), $temp);
			$temp = str_replace('$'.'{脚文件}', $this->footerFile($get), $temp);
			$str_link  = '';
			
			if ($max_page == 1) {
				$temp = str_replace('$'.'{link代码}', $str_link, $temp);
			} else if ($i == 1 ) {
				$str_link = '<link rel="next" href="'.'../../'.$dirurl.'/'.($i + 1).'.html"/>';
				$temp = str_replace('$'.'{link代码}', $str_link, $temp);
			} else if ($i >1 && $i < $max_page) {
				$str_link = '<link rel="canonical" href="'.'../../'.$dirurl.'/'.'"/>';
				if (($i - 1) == 1) {
					$str_link .= '<link rel="prev" href="'.'../../'.$dirurl.'/"/>';
				} else {
					$str_link .= '<link rel="prev" href="'.'../../'.$dirurl.'/'.($i - 1).'.html"/>';
				}
				$str_link .= '<link rel="next" href="'.'../../'.$dirurl.'/'.($i + 1).'.html"/>';
				$temp = str_replace('$'.'{link代码}', $str_link, $temp);
				
			} else if ($i == $max_page) {
				
				$str_link = '<link rel="canonical" href="'.'../../'.$dirurl.'/'.'"/>';
				if (($i - 1) == 1) {
					$str_link .= '<link rel="prev" href="'.'../../'.$dirurl.'/"/>';
				} else {
					$str_link .= '<link rel="prev" href="'.'../../'.$dirurl.'/'.($i - 1).'.html"/>';
				}
				$temp = str_replace('$'.'{link代码}', $str_link, $temp);
			}

			if ($i == 1) {
				file_put_contents($dir.'/index.html', $temp);
			
			}else{
				file_put_contents($dir.'/'.$i.'.html', $temp);
			}
		}
		return '';
	}
	
	/**
	* 得到产品HowTos 生成分页
	*
	* @param   array      		 $get       字段数组
	* @return  string
	*/
	function getProductHowTosCreatePage($get = array() ) {
	
		$arr = $this->productHowTosCreatePage($get);
		$webInfo = $arr['webInfo'];
		$total = $arr['total'];
		$max_page = $arr['max_page'];
		$dirurl = $arr['dirurl'];
		$dir = $arr['dir'];
		$template_str = $arr['template_str'];
		$all = $arr['all'];
		
		for ($i = 1; $i <= $max_page; $i++) {
			$list = '';
			$temp = $template_str;
			$page_start = ($i - 1) * 10 + 1;
			$page_end = ($i - 1) * 10 + 10;
			
			if ($page_end >= $total) {
				$page_end = $total;
			}
			
			$chang_sum = 0;
			$k = 0;
		
			for ($j = ($i - 1)* 10; $j <= $i * 10 - 1; $j++) {
				if ($j >= $total) {
					break;   
				}
				
				$url = url_new_replace($all[$j]['url'], $webInfo['url_type'], $webInfo['web_domain']);
				
				if ($k % 2 == 0) {
					$list .= '<div class="item">';
				} else {
					$list .= '<div class="item bg">';
				} 
				
				$chang_sum = $chang_sum + 1;
				$list .= '<img src="../../style/style_img/other_03.png"  
				width="45" height="42" class="fl" /><dl class="text"><dt><a href="'.      
				$url.'">'.$all[$j]['title'].'</a></dt><dd>'.$all[$j]['description'].'</dd></dl></div>';
				$k = $k +1;
			}

			$page = '';
			if ($total > 10) {
				//分页
				$page = '<div id="page">';
				if ( $i  > 1 ) {
					if ($i -1 == 1) {
						$page .= '<a href="'.'../../'.$dirurl.'/" >Prev Page</a>';
					} else {
						$page .= '<a href="'.'../../'.$dirurl.'/'.($i - 1).'.html" >Prev Page</a>';
					}
				} else {
					$page .= '<a>Prev Page</a>';
				}
				
				$start = $i - 4;
				$end = $i + 4;
				
				if ($start < 1) {
					$start = 1; $end = 6;
				}
				
				if ($end > $max_page) {
					$end = $max_page; $start = $max_page - 5;
				}
				
				if ($start < 1) {
					$start = 1;
				}
				
				if ($start != 1) {
					$output .= '';
				}
				
				for ($start; $start <= $end; $start++) {
					
					if ($i == $start) {
						$page .= '<a class="now_page" >'.$start.'</a>';
					} else {
						if ($start == 1) {
							$page .= '<a href="'.'../../'.$dirurl.'/">'.$start.'</a>';
						} else {
							$page .= '<a href="'.'../../'.$dirurl.'/'.$start.'.html">'.$start.'</a>';
						}
					}
				}
				
				if ($end != $max_page) {
					$output .= '';
				}
				
				if ($i < $max_page) {
					$page .= '<a href="'.'../../'.$dirurl.'/'.($i+1).'.html" >Next Page</a>';
				} else {
					$page .= '<a >Next Page</a>';
				}
				
				$page .= '</div><div class="fr">Results '.$page_start.' - '.$page_end.'  of '.$total.'</div>
				<div class="clear"></div>';
			}
			
			$page = '<div class="helist">'.$list.'</div>'.$page;//列表与分页div合并
			//不等于预览
			if ($get['do'] == 'view') {
				return $page;
			}
			$temp = str_replace("<!--page_module-->", $page, $temp);
			$temp = str_replace('$'.'{页面关键字}', $get['页面关键字'], $temp);
			$temp = str_replace('$'.'{页面描述}', $get['页面描述'], $temp);
			
			$temp = str_replace('$'.'{产品HowTos列表和分页信息}', '', $temp);
			$temp = str_replace('$'.'{OrderSupport首页链接}', $this->getOrderIndexHref($get), $temp);
			$temp = str_replace('$'.'{ProductsSupport首页链接}', $this->getProductsIndexHref($get), $temp);
			$temp = str_replace('$'.'{产品history链接}', $this->getProductHistoryHref($get), $temp);	
			$temp = str_replace('$'.'{overview链接}', $this->getProductOverviewHref($get), $temp);	
			$temp = str_replace('$'.'{产品suggestion链接}', $this->getProductSuggestionHref($get), $temp);
			$temp = str_replace('$'.'{是否有在线帮助}', $this->getProductOnhelpHref($get), $temp);
			
			$temp = str_replace('$'.'{是否有Troubleshooting}', $this->getProductHowtosHref($get), $temp);
			$temp = str_replace('$'.'{是否有视频}', $this->getProductVideoHref($get) ,$temp);
			$temp = str_replace('$'.'{右侧文章以及随机文章}', $this->getProductRightArticle($get), $temp);
			$temp = str_replace('$'.'{产品ID}', $get['产品ID'], $temp);
			$temp = str_replace('$'.'{页面标题}', $get['页面标题'].' of '.$i, $temp);
	
			$temp = str_replace('$'.'{产品cbsid}', $get['产品cbsid'], $temp);
			$temp = str_replace('$'.'{产品名称}', $get['产品名称'], $temp);
			$temp = str_replace('$'.'{登录html}', $this->getLoginHtml($get), $temp);
			$temp = str_replace('$'.'{登录js}', $this->getLoginJs($get), $temp);
			$temp = str_replace('$'.'{头文件}', $this->headerFile($get), $temp);
			$temp = str_replace('$'.'{脚文件}', $this->footerFile($get), $temp);
		
			$str_link  = '';
			if ($max_page == 1) {
				$temp = str_replace('$'.'{link代码}', $str_link, $temp);
			} else if ($i == 1 ) {
			
				$str_link = '<link rel="next" href="'.'../../'.$dirurl.'/'.($i + 1).'.html"/>';
				$temp = str_replace('$'.'{link代码}', $str_link, $temp);
			} else if ($i > 1 && $i < $max_page) {
				$str_link = '<link rel="canonical" href="'.'../../'.$dirurl.'/'.'"/>';
				if (($i - 1) == 1) {
					$str_link .= '<link rel="prev" href="'.'../../'.$dirurl.'/"/>';
				} else {
					$str_link .= '<link rel="prev" href="'.'../../'.$dirurl.'/'.($i - 1).'.html"/>';
				}
				
				$str_link .= '<link rel="next" href="'.'../../'.$dirurl.'/'.($i + 1).'.html"/>';
				$temp = str_replace('$'.'{link代码}', $str_link, $temp);
			} else if ($i == $max_page) {
				
				$str_link = '<link rel="canonical" href="'.'../../'.$dirurl.'/'.'"/>';
				if (($i - 1) == 1) {
					$str_link .= '<link rel="prev" href="'.'../../'.$dirurl.'/"/>';
				} else {
					$str_link .= '<link rel="prev" href="'.'../../'.$dirurl.'/'.($i - 1).'.html"/>';
				}
				$temp = str_replace('$'.'{link代码}', $str_link, $temp);
			}

			if ($i == 1) {
				file_put_contents($dir.'/index.html', $temp);
			
			}else{
				file_put_contents($dir.'/'.$i.'.html', $temp);
			}
			
		}
		
	}
	
	
}
?>